1. Field of the Invention
The present invention relates to a method, system, and computer program product for determining an end of valid log in a log of write records.
2. Description of the Related Art
In a log structured file system, a record is created when a write operation is performed with respect to a file, where the record includes metadata for the record, such as a sequence number and error correction code, and user data. The records are then written sequentially to a log in a storage device. In a log structured file system, all modifications are written to disk sequentially in a log-like structure to speed-up both file writing and crash recovery. Records written sequentially to the log may not be in contiguous physical spaces on the disk. The log may be the only structure on disk. The log may contain indexing information so that files can be read back from the log efficiently. Further, a plurality of writes can be sent to the disk at the same time and such writes may complete in an order different from the order in which they were sent. The last write started might be the first to finish.
During write operations, the log structured file system may periodically save a checkpoint to the disk indicating the valid end of log, or most recently written complete record, such that all previous records in the log to the valid end of log have also been successfully written to disk. After a restart operation, the operating system reads the checkpoint saved to disk to determine the state of the disk as of the last completed write and where to start writing log records. In certain systems, a portion of the disk may be allocated to store the checkpoint and updated during log operations to indicate the current end of the log.
There is a need in the art for improved techniques for determining the end of the log.